	//选择某个对象
	function G(id){
	    return document.getElementById(id);
	}
	function N(id){
	    return document.getElementsByName(id);
	}
	//判断是否是数字
	 function isNumber(v)
	 {
	   return (!isNaN(v) && !/^\s+$/.test(v));
	 }	
	//删除多条记录
	function SelectDel(){   //删除
	     var obj = Validate();
	     if(obj != ''){
	     	if( window.confirm('你确定要删除吗')){
	     		if(obj.length>100){
	     			alert("一次性删除过多,请减少删除量！");
	     		}else{
		     		return obj.substring(1);  	
	     		}
	     	}
	     	else{
	     		return '';
	     	}
	      }
	      else if(obj==''){
	         alert('请选择要删除的数据！');
	         return '';
	      }
	  }
	  /**
	  	选择删除的对象  zhangyq
	  **/
	 function Validate(){
	     var objs = window.document.getElementsByTagName('input');
	     var ids='';
	     for(var j=0;j<objs.length;j++) {
	        if(objs[j].type=='checkbox'){
	            if(objs[j].checked == true){
	                ids = ids + "," + objs[j].value ;
	            }
	        }
	     }
	     return ids;
	     for(var i=0;i<objs.length;i++){
	          if(objs[i].type=='checkbox'){
	               if(objs[i].checked == true){
	                    return true;
	               }
	          }
	     }
	}
	//checkbox全选
	function selectAll(){
        var objs = document.getElementsByTagName('input');
        var i;
        for(i = 0; i < objs.length; i++){
            if(objs[i].type == "checkbox"){
                objs[i].checked = true;
				objs[i].disabled = false;
            }
        }
	}
	 //checkbox反选
	function unselect(){
        var objs = document.getElementsByTagName('input');
        var i;
        for(i=0;i<objs.length;i++){
            if(objs[i].type=='checkbox'){
                if(objs[i].checked == true){
                    objs[i].checked =false;
                }
                else{
                    objs[i].checked =true;
                }
				objs[i].disabled = false;
            }
        }
	}
	 //checkbox取消
	function cancel(){
       var objs = document.getElementsByTagName('input');
       var i;
       for(i=0;i<objs.length;i++){
           if(objs[i].type == 'checkbox'){
               objs[i].checked = false;
			   objs[i].disabled = false;
           }
        }
	}
	//选择对话框
	function warning(msg, content) {
		var message = "您确定要执行此项操作：" + "\n\n" + msg +" "+ content + "";
		if (window.confirm(message)) {
			return true;
		}
		return false;
	}
	//
	function getOptionValue(id) {
		var s = document.getElementById(id);
		window.alert(s.options[s.selectedIndex].value);
		return s.options[s.selectedIndex].value;
	}

	//检查radio组是否有被选中 选中的返回对应的值，若没有选中返回‘’
	//radio默认name为 radio
	function checkradio(){
		var f=document.all
		var checkedvalue='';
	    var lt=f.radio.length;
	    if(lt==null){
	       if(f.radio.checked){
	          checkedvalue=f.radio.value;
	       }
	    }
	    else{
			 for (i=0;i<f.radio.length;i++){
				 if(f.radio[i].checked == true){
					checkedvalue=f.radio[i].value;
				 }
			 }
		}
		return checkedvalue;
	}
	//去除js的字符对象两边的空格
	String.prototype.trim = function(){
	     return this.replace(/(^\s*)|(\s*$)/g, '');
	};
	//异步提交表单时 根据 form的名字和要提交的action得到需要的url
	function getUrl(formname,action){
		var form = document.getElementById(formname);
		var ele = form.elements;
		var url=action+".action?";
 		for(var i = 0 ;i <ele.length ;i++){
		     var v = "" ;
		     var id=  ele[i].id;
		 	 if(ele[i].type=='hidden' || ele[i].type=='text'||ele[i].id=='select'||ele[i].id=='select1'||ele[i].id=='select2'){
		          var v;
		      	  v = ele[i].value;
		     }
		  	 if(v != ""){
		 	 	url=url+ele[i].name+"="+v+"&";
		     }
       }
       url=url.substr(0,url.lastIndexOf("&"));
       return url;
    }

	/**
	 * @param str 输入字符串,判断字符串中是否为空
	 */
	function isEmpty(str) {
		for (var i = 0; i < str.length; i++){
	  		if (str.charAt(i) !== "") {
	    		return false;
	  		}
	 	}
	 	return true;
	}
	function setTrBgColor(oTr,b){
		oTr.rowIndex % 2 != 0 ? oTr.style.backgroundColor = b ? aBgColor[3] : aBgColor[1] : oTr.style.backgroundColor = b ? aBgColor[2] : aBgColor[0];
	}
	//window.onload = function(){addTableListener(document.getElementById("tbColor"),0,0);}
	
	/** 
		初始化日历控件  调用时,要传对象的id,如要在文本框上加载日历控件,则传文本框的id
		id: 文本框的id
	**/
	function initCalendar(id){
  			mCal1 = new dhtmlxCalendarObject(id); 
		    dhtmlxCalendarLangModules = new Array();
 
			//set new language and date format
			dhtmlxCalendarLangModules['de'] = {
			     langname:    'de',
			     dateformat:    '%Y-%m-%d',
			     monthesFNames:    ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
			     monthesSNames:    ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
			     daysFNames:    [ "日","一", "二", "三", "四", "五", "六"],
			     daysSNames:    ["日","一", "二", "三", "四", "五", "六" ],
			     weekend: [0, 6],
				 weekstart: 1,
				 msgClose: "关闭",
				 msgMinimize: "最小化",
				 msgToday: "今天",
				 msgClear: "清空"
			}	 
			//apply any existing language and date format
			mCal1.loadUserLanguage("de"); 
	        mCal1.draw();	
	
	}
	/**
	 * 验证文件是否为Excel
	 *update by liangchao 2009-11-23
	 */
	function checkImpExcel(id){
		var fileName = document.getElementById(id).value;
		if(isEmpty(fileName)){
			alert("请选择文件!");
			return false;
		}
		if(fileName.lastIndexOf(".") != -1) {
			var fileType = (fileName.substring(fileName.lastIndexOf(".")+1,fileName.length)).toLowerCase();
			var suppotFile = new Array();
			suppotFile[0] = "xls";
			for(var i =0;i<suppotFile.length;i++){
				if(suppotFile[i] == fileType){
					return true;
				}else{
					continue;
				}
			}
			alert("不支持文件类型."+fileType);
			return false;
		} else {
			alert("文件类型只支持.xls");
		}
		return true;
	}	